using System;
using System.Collections.Generic;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Globalization;
using FEL.ACT;
using System.Web.UI.HtmlControls;

public partial class ACT_ACT_ACTIVO_ATRIBUTO : PaginaBaseKCG
{
    protected void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);
        cargarBotones();
        fvact_activo_atributo.DataBound += new EventHandler(fvact_activo_atributo_DataBound);
    }

    void fvact_activo_atributo_DataBound(object sender, EventArgs e)
    {                   
        
    }

    private void cargarBotones()
    {
        ActivoButton.Text = GetLocalResourceObject("Btn_Act_Activo_Atributo_ActivoRecursoKCG.Text").ToString();
        ActivoButton.ToolTip = GetLocalResourceObject("Btn_Act_Activo_Atributo_ActivoRecursoKCG.ToolTip").ToString();
    }


    protected override CheckBox CbInsertarMemoria
    {
        get { return null; }
    }

    protected override Type TipoObjeto
    {
        get { return typeof(global::Act_Activo_Atributo); }
    }

    protected override GridView Gv
    {
        get { return gvact_activo_atributo; }
    }

    protected override FormView Fv
    {
        get { return fvact_activo_atributo; }
    }

    protected override ObjectDataSource OdsGv
    {
        get { return odsgvact_activo_atributo; }
    }

    protected override ObjectDataSource OdsDv
    {
        get { return odsfvact_activo_atributo; }
    }

    protected override Button BResponderZoom
    {
        get { return Seleccionar; }
    }

    protected override Button BRegreso
    {
        get { return Atras; }
    }


    protected override Koala.KoalaWebControls.KFiltro KftFiltro
    {
        get { return kftFiltro; }
    }
    protected override string Contenedor
    {
        get { return "ACT_ACTIVO_ATRIBUTO"; }
    }

    protected void nav_Siguiente(object sender, EventArgs e)
    {
        Gv_SelectedIndexChanged(sender, e);
    }

    protected override void DefinirParametrosFijosDeInsercion(System.Collections.Generic.List<DictionaryEntry> param)
    {
        if (Request.QueryString.Count > 0)
        {
            param.Add(new DictionaryEntry("Act_Activo_Id", Request.QueryString["Act_Activo_Id"]));
            param.Add(new DictionaryEntry("Act_Activo_Codigo", Request.QueryString["Act_Activo_Codigo"]));
            param.Add(new DictionaryEntry("Act_Activo_Nombre", Request.QueryString["Act_Activo_Nombre"]));

        }
        base.DefinirParametrosFijosDeInsercion(param);
    }

    [WebMethod]
    static public string[] GetMaterial(string prefixText, int count)
    {
        if (count == 0) count = 10;

        Scope s = (Scope)HttpContext.Current.Session["Scope"];

        FEL.ACT.BO_Act_Atributo boActAtributo = new BO_Act_Atributo();
        List<Act_Atributo> litActAtributo = boActAtributo.GetByLikeNombre("Nombre", s, prefixText + "%");

        List<string> opciones = new List<string>();
        for (int i = 0; i < litActAtributo.Count && i < count; i++)
        {
            string value = litActAtributo[i].Id + "||" +
                           litActAtributo[i].Codigo;

            opciones.Add(AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(litActAtributo[i].Nombre, value));
        }

        return opciones.ToArray();
    }

    [WebMethod]
    static public string[] GetSugerencia(string prefixText, int count, string contextKey)
    {
        if (count == 0) count = 10;

        Scope s = (Scope)HttpContext.Current.Session["Scope"];

        FEL.ACT.BO_Act_Atributo_Det boActAtributoDet = new BO_Act_Atributo_Det();
        List<Act_Atributo_Det> litActAtributoDet = boActAtributoDet.GetByLikeNombre("Nombre", s, prefixText + "%", contextKey);

        List<string> opciones2 = new List<string>();
        for (int i = 0; i < litActAtributoDet.Count && i < count; i++)
        {
            string value = litActAtributoDet[i].Id;
                           

            opciones2.Add(AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(litActAtributoDet[i].Nombre, value));
        }
        return opciones2.ToArray();
    }

    private const string comandFormat = "RutaDestino: ~/ACT/ACT_ATRIBUTO_DET.aspx?Act_Atributo_Id = {0}; Filtro: Descripcion; Obtener: Descripcion|Nombre";

    protected void Button3_Click(object sender, EventArgs e)
    {
        TextBox Act_AtributoId = (TextBox)Fv.FindControl("Act_Atributo_Id");
        Button botonZooom = (Button)sender;
        botonZooom.CommandArgument = string.Format(comandFormat, Act_AtributoId.Text);
    }
    protected void ActivoButton_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/ACT/ACT_ACTIVO.aspx" +
            "?Act_Activo_Id=" + Request.QueryString["Act_Activo_Id"] +
            "&Act_Activo_Codigo=" + Request.QueryString["Act_Activo_Codigo"] +
            "&Act_Activo_Nombre=" + Request.QueryString["Act_Activo_Nombre"]);
    }


}
